<template>
  <a-modal :maskClosable="false"
    title="详情"
    :width="1248"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">

    <a-spin :spinning="confirmLoading">
      <a-row style="margin-bottom: 50px">
        <a-steps :current="model.orderStatus">
          <a-step title="待接订单"/>
          <a-step title="待服务" />
          <a-step title="服务中" />
          <a-step title="待评价" />
          <a-step title="已完成" />
        </a-steps>
      </a-row>
      <a-descriptions title="基本信息" bordered>
        <a-descriptions-item label="下单会员">
          {{model.memberName}}
        </a-descriptions-item>
        <a-descriptions-item label="定制类型">
          {{model.customType=='1'?'居家护工':model.customType=='2'?'住院护工':model.customType=='3'?'陪诊师':model.customType=='4'?'挂号服务':'其他服务'}}
        </a-descriptions-item>
        <a-descriptions-item label="订单状态">
          {{model.orderStatus=='0'?'等接单':model.orderType=='1'?'己接单':model.orderType=='2'?'客户己取消':'商家取消'}}
        </a-descriptions-item>
        <a-descriptions-item label="总费用 (元)" >
          {{model.amount}}
        </a-descriptions-item>
        <a-descriptions-item label="备住" >
          {{model.beanInfoDto.remark}}
        </a-descriptions-item>
      </a-descriptions>
      <a-descriptions title="服为内容" bordered style="margin-top: 50px" v-if="model.customType==1||model.customType==6">
        <a-descriptions-item label="定制内容">
          {{model.beanInfoDto.taskName}}
        </a-descriptions-item>
        <a-descriptions-item label="陪护类型">
          {{model.beanInfoDto.taskType}}
        </a-descriptions-item>
        <a-descriptions-item label="陪护开始时段" v-if="model.beanInfoDto.taskType=='自定义'">
          {{model.beanInfoDto.beginTime}}
        </a-descriptions-item>
        <a-descriptions-item label="陪护结束时段" v-if="model.beanInfoDto.taskType=='自定义'">
          {{model.beanInfoDto.endTime}}
        </a-descriptions-item>
        <a-descriptions-item label="开始服务日期" >
          {{model.beanInfoDto.startDay}}
        </a-descriptions-item>
        <a-descriptions-item label="陪护天数">
          {{model.beanInfoDto.day}}
        </a-descriptions-item>
        <a-descriptions-item label="是否有性别限制" >
          {{model.beanInfoDto.izSexLimit=="0"?"女":model.beanInfoDto.izSexLimit=="1"?"男":"无"}}
        </a-descriptions-item>
      </a-descriptions>

      <a-descriptions title="服为内容" bordered style="margin-top: 50px" v-if="model.customType==2">
        <a-descriptions-item label="陪护类型">
          {{model.beanInfoDto.taskType}}
        </a-descriptions-item>
        <a-descriptions-item label="陪护开始时段" v-if="model.beanInfoDto.taskType=='自定义'">
          {{model.beanInfoDto.beginTime}}
        </a-descriptions-item>
        <a-descriptions-item label="陪护结束时段" v-if="model.beanInfoDto.taskType=='自定义'">
          {{model.beanInfoDto.endTime}}
        </a-descriptions-item>
        <a-descriptions-item label="开始服务日期" >
          {{model.beanInfoDto.startDay}}
        </a-descriptions-item>
        <a-descriptions-item label="陪护天数">
          {{model.beanInfoDto.day}}
        </a-descriptions-item>
        <a-descriptions-item label="是否有性别限制" >
          {{model.beanInfoDto.izSexLimit=="0"?"女":model.beanInfoDto.izSexLimit=="1"?"男":"无"}}
        </a-descriptions-item>
      </a-descriptions>


      <a-descriptions title="服为内容" bordered style="margin-top: 50px" v-if="model.customType==3">
        <a-descriptions-item label="开始服务日期">
          {{model.beanInfoDto.startDay}}
        </a-descriptions-item>
        <a-descriptions-item label="开始时段">
          {{model.beanInfoDto.beginTime}}
        </a-descriptions-item>
        <a-descriptions-item label="陪护小时" >
          {{model.beanInfoDto.hour}}
        </a-descriptions-item>
        <a-descriptions-item label="是否有性别限制" >
          {{model.beanInfoDto.izSexLimit=="0"?"女":model.beanInfoDto.izSexLimit=="1"?"男":"无"}}
        </a-descriptions-item>
        <a-descriptions-item label="是否上门接送" >
          {{model.beanInfoDto.izDoor=="0"?"不需要":"需要"}}
        </a-descriptions-item>

        <a-descriptions-item label="就诊医院" >
          {{model.beanInfoDto.hospital}}
        </a-descriptions-item>

        <a-descriptions-item label="是否有家属陪同" >
          {{model.beanInfoDto.izHasFamily=="0"?"没有陪同":"有陪同"}}
        </a-descriptions-item>

      </a-descriptions>


      <a-descriptions title="服为内容" bordered style="margin-top: 50px" v-if="model.customType==4">
        <a-descriptions-item label="开始服务日期">
          {{model.beanInfoDto.startDay}}
        </a-descriptions-item>
        <a-descriptions-item label="开始时段">
          {{model.beanInfoDto.beginTime}}
        </a-descriptions-item>
        <a-descriptions-item label="是否有性别限制" >
          {{model.beanInfoDto.izSexLimit=="0"?"女":model.beanInfoDto.izSexLimit=="1"?"男":"无"}}
        </a-descriptions-item>
      </a-descriptions>


      <a-descriptions title="服为内容" bordered style="margin-top: 50px" v-if="model.customType==5">
        <a-descriptions-item label="就诊医院" >
          {{model.beanInfoDto.hospital}}
        </a-descriptions-item>

        <a-descriptions-item label="就诊科室" >
          {{model.beanInfoDto.department}}
        </a-descriptions-item>

        <a-descriptions-item label="意向医生" >
          {{model.beanInfoDto.doctor}}
        </a-descriptions-item>

      </a-descriptions>

      <a-descriptions title="被护理人" bordered style="margin-top: 50px">
        <a-descriptions-item label="被护理人年龄">
          {{model.beanInfoDto.patientAge+" 岁"}}
        </a-descriptions-item>
        <a-descriptions-item label="自理情况">
          {{model.beanInfoDto.selfCareSituation}}
        </a-descriptions-item>
        <a-descriptions-item label="手术/疾病">
          {{model.beanInfoDto.record}}
        </a-descriptions-item>
        <a-descriptions-item label="被服务对像省市区" >
          {{model.beanInfoDto.provinceName+model.beanInfoDto.cityName+model.beanInfoDto.districtName}}
        </a-descriptions-item>
      </a-descriptions>
    </a-spin>
  </a-modal>
</template>

<script>
import { httpAction, putAction, getAction, postAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'ordStoreTableAreaModal',
  mixins: [JeecgListMixin],
  data() {
    return {
      title: '操作',
      visible: false,
      model: {},
      layout: {
        labelCol: { span: 4 },
        wrapperCol: { span: 14 }
      },
      disableMixinCreated:true,
      confirmLoading: false,
      loading:false,
      dataSource:[],
      // 表头
      columns: [
        {
          title: '商品类型',
          align: 'center',
          dataIndex: 'goodsType',
          width: 150,
          customRender: function(t, r, index) {
            //1一体机食谱 2一体机运动方案 3一体机整套方案
            if (t == '1') {
              return '食谱方案'
            } else if (t == '2') {
              return '运动方案'
            } else if (t == '3') {
              return '整套方案'
            }
            return ''
          }
        },
        {
          title: '商品名称',
          align: 'center',
          dataIndex: 'goodsName',
          width: 200
        },
        {
          title: '商品图片',
          align: 'center',
          dataIndex: 'goodsImg',
          width: 180,
          scopedSlots: { customRender: 'imgSlot' }
        },
        {
          title: '商品单价',
          align: 'center',
          dataIndex: 'goodsPrice',
          width: 100
        },
        {
          title: '购买数量',
          align: 'center',
          dataIndex: 'totalNum',
          width: 100
        },
        {
          title: '商品总价(元)',
          align: 'center',
          dataIndex: 'totalPrice',
          width: 110
        },
        {
          title: '商品实付总价(元)',
          align: 'center',
          dataIndex: 'totalPayPrice',
          width: 110
        }
      ],
      url: {
        add: '',
        get: '/store/order/list/customized/get',
        listGoods:'/store/order/goods',
      }
    }
  },
  created() {
    this.modelDefault = JSON.parse(JSON.stringify(this.model))

  },
  methods: {
    add() {
      this.edit(this.modelDefault)
    },
    edit(record) {
      const that = this
      that.model.id = record.id
      getAction(this.url.get + '/' + record.id).then((res) => {
        if (res.success) {
          that.model = res.result
        }
      })
      getAction(this.url.listGoods + '/' + record.orderNo).then((res) => {
        if (res.success) {
          that.dataSource = res.result
        }
      })
      that.visible = true
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      this.close()
    },
    handleCancel() {
      this.close()
    }

  }
}
</script>

<style scoped>

</style>
